<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 <head>
    <title>编辑影人信息</title>
   <link rel="stylesheet" href="/admin/css/pintuer.css"/>
   <link rel="stylesheet" href="/admin/css/admin.css"/>
   <link  href="/admin/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css"/>
   <link href="/admin/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all" />
   <script src="/admin/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
   <script src="/admin/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
   <script src="/admin/js/pintuer.js"></script>
    <style type="text/css">
    	.occupation-box {
    		border:1px solid #ddd; width:300px!important; height:100px; padding:20px;
    	}
    	.occupation-box > label {margin-right:22px;}
    </style>
    <script type="text/javascript" src="/admin/js/ajaxfileupload.js"></script>
    
    <script type="text/javascript">
    
    function ajaxFileUpload(id,ImgId) {
    	$.ajaxFileUpload({
    		url : '/file/upload/image',
    		secureuri : false,//当前URI是否是安全的 路径
    		fileElementId : id,//使用ID属性找到文件输入框
    		dataType : 'json',//服务器返回数据是什么格式
    		success : function(data, status) {
    			var isok=data.isok;
    			if(isok==1){
    				$(ImgId).attr("data-image","/file/image/"+data.filename);
    				$(ImgId).val(data.filename);
    				alert('上传成功');
    			}
    		},
    		error : function(data, status, e) {
    			alert('上传出错');
    		}
    	});
    	return false;
    }
    function ajaxFileUpload2(id) {
    	$.ajaxFileUpload({
    		url : '/file/upload/video',
    		secureuri : false,
    		fileElementId : id,
    		dataType : 'json',
    		success : function(data, status) {
    			var isok=data.isok;
    			if(isok==1){
    				$("#video1").attr("data-image","/file/image/"+data.filename);
    				$("#video1").val(data.filename);
    				alert("上传成功");
    			}
    		},
    		error : function(data, status, e) {
    			alert('上传出错');
    		}
    	});
    	return false;
    }
    function yanzheng(){
    	var name=$("#name").val();
    	var orderby=$("#orderby").val();
    	if($.trim(name)==""){
    		alert("名称不能为空");
    		return;
    	}
    	if($.trim(orderby)!=""&&isNaN(orderby)){
    		alert("顺序号必须为数字");
    		return;
    	}
    	$("#form").submit();
    }
    
    </script> 
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong><span class="icon-pencil-square-o"></span>影片信息</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="/admin/film/updateoradd" id="form">
      <div class="form-group">
        <div class="label">
          <label>影片名称：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="name" th:value="${film!=null?film.name:''}" size="100" id="name"/>
           <input type="hidden" name="id" th:value="${film!=null ? film.id:''}"/>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>电影别名：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="anotherName" th:value="${film!=null?film.anotherName: ''}" size="100" id="name" >
          <div class="tips"></div>
        </div>
      </div>
<!--      <div class="form-group">-->
<!--        <div class="label">-->
<!--          <label>导演：</label>-->
<!--        </div>-->
<!--        <div class="field">-->
<!--          <input type="text" class="input" name="director" value="${film.director}" size="100" id="name"/>-->
<!--          <div class="tips"></div>-->
<!--        </div>-->
<!--      </div>-->
<!--      <div class="form-group">-->
<!--        <div class="label">-->
<!--          <label>编剧：</label>-->
<!--        </div>-->
<!--        <div class="field">-->
<!--          <input type="text" class="input" name="screenwriter" value="${film.screenwriter}" size="100" id="name"/>-->
<!--          <div class="tips"></div>-->
<!--        </div>-->
<!--      </div>-->
<!--      <div class="form-group">-->
<!--        <div class="label">-->
<!--          <label>主演：</label>-->
<!--        </div>-->
<!--        <div class="field">-->
<!--          <input type="text" class="input" name="tostar" value="${film.tostar}" size="100" id="name"/>-->
<!--          <div class="tips"></div>-->
<!--        </div>-->
<!--      </div>-->
      <div class="form-group">
        <div class="label">
          <label>上映日期：</label>
        </div>
        <div class="field">
          <input type="date" name="releaseTime" class="input"  th:value="${film!=null ? #dates.format(film.releaseTime,'yyyy-MM-dd'): ''}" />
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>时长：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="length" th:value="${film!=null ? film.length : ''}" size="100" id="name"/>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>国家：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="country" th:value="${film!=null ? film.country : ''}" size="100" id="name"/>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>分类：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="type" th:value="${film!=null ? film.type: ''}" size="100" id="name"/>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>语言：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="language" th:value="${film!=null ? film.language :''}" size="100" id="name"/>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>购片连接：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="ticketLink" th:value="${film!=null ? film.ticketLink: ''}" size="256" id="name"/>
          <div class="tips"></div>
        </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>封面：</label>
        </div>
        <div class="field">
          <input type="text" id="img1" name="pic1" class="input tips" style="width:35%; float:left;" th:value="${film!=null ? film.pic1: ''}" data-toggle="hover" data-place="right"  th:data-image="'/file/image/'+${film!=null?film.pic1:'default.jpg'}" readonly="readonly" />
          <input type="file"  id="file1" name="file" onchange="ajaxFileUpload('file1','#img1')"/>
          <!-- <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传" onclick="ajaxFileUpload('file')" /> -->
        </div>
      </div>

      <div class="form-group">
        <div class="label">
          <label>大图：</label>
        </div>
        <div class="field">
          <input type="text" id="img2" name="pic2" class="input tips" style="width:35%; float:left;" th:value="${film!=null ? film.pic2: ''}" data-toggle="hover" data-place="right"  th:data-image="'/file/image/'+${film!=null?film.pic2:'default1.jpg'}" readonly="readonly" />
          <input type="file"  id="file2" name="file" onchange="ajaxFileUpload('file2','#img2')"/>
          <!-- <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传" onclick="ajaxFileUpload('file')" /> -->
        </div>
      </div>

      <div class="form-group">
        <div class="label">
          <label>电影片段：</label>
        </div>
        <div class="field">
          <input type="text" id="video1" name="videoLink" class="input tips" style="width:25%; float:left;" th:value="${film!=null ? film.videoLink: ''}" data-toggle="hover" data-place="right"  data-image="${bankuai.img}" readonly="readonly" />
          <input type="file"  id="file3" name="file" onchange="ajaxFileUpload2('file3')"/>
          <!-- <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传" onclick="ajaxFileUpload('file')" /> -->
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>简介：</label>
        </div>
        <div class="field">
        <textarea style="height: 200px; width: 500px;" class="input" name="plot" th:text="${film!=null ? film.plot:''}"></textarea>
          <!-- <div class="tips">如为空则按顺序排列</div> -->
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button border-main icon-check-square-o" type="submit"> 提交</button>
          <button class="button border-red icon-tags" type="button" onclick="window.history.go(-1);"> 返回</button>
        </div>
      </div>
    </form>
  </div>
</div>
</body></html>